package com.foodie.servlet;

import com.foodie.entity.Menu;
import com.foodie.service.UserimgService;
import com.google.gson.Gson;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/ajax")
public class ImgsServlet extends HttpServlet {
    UserimgService user = new UserimgService();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        List<Menu> userList = user.getListimg();

        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().println(new Gson().toJson(userList));
    }
}
